#ifndef _TD_TURRET_TILEMAP_H_ 
#define _TD_TURRET_TILEMAP_H_

/************************************************************************/
/* Resources                                                            */
/************************************************************************/
#include "Resources/Tiles/Tilemap.h"

using namespace TD_Core;
using namespace TD_Resources;

namespace TD_Game {

	class TurretTilemap : public Tilemap {
		
	protected:

		enum {
			turretBottom,
			turretTop
		} tileRelativePosition;
	
		/************************************************************************/
		/* Protected functions                                                  */
		/************************************************************************/
		Tile * createNewTile(unsigned int i, unsigned int j, int relativePosition, int relativeTilesetPosition);
	
		inline Coord2D getTileposition(unsigned int i, unsigned int j, int relativePosition) const {
			Coord2D tilePosition;
			tilePosition.x = m_position.x + m_pTileset->getTilesize().x*j;
			tilePosition.y = m_position.y + m_pTileset->getTilesize().y * (i - relativePosition);
			return (tilePosition);
		}

	public: 

		/************************************************************************/
		/* ctors and dtors                                                      */
		/************************************************************************/
		explicit TurretTilemap();

		explicit TurretTilemap(const TurretTilemap &rhs);

		~TurretTilemap();

		//Initialization constructor
		explicit TurretTilemap(const Tileset *g_pTileset);

		/************************************************************************/
		/* Functionalities                                                      */
		/************************************************************************/
		virtual bool loadTilemap(const Tileset *g_pTileset, const string &tileMapStr, const Coord2D & mapPosition, const Coord2D &numTiles);
		virtual bool loadTilemap(const string &tileMapStr, const Coord2D & mapPosition, const Coord2D &numTiles);

		inline Coord2D getTileposition(unsigned int i, unsigned int j) const {
			return(getTileposition(i, j, turretBottom));
		}
	};
}

#endif